package cn.bdqn.tangcco.user.dao.impl;

import cn.bdqn.tangcco.entity.Tbuser;
import cn.bdqn.tangcco.user.dao.UserDao;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import javax.inject.Inject;

/**
 * Created by Administrator on 2016/6/2.
 */
@Repository
public class UserDaoImpl implements UserDao {

    @Inject
    private SessionFactory sessionFactory;


    @Override
    public Tbuser login(Tbuser users) {
        return (Tbuser) this.sessionFactory.getCurrentSession()
                .createQuery("from Tbuser users where users.username=:username and users.password=:password")
                .setParameter("username",users.getUsername())
                .setParameter("password",users.getPassword())
                .uniqueResult();
    }











}
